<!DOCTYPE html>
<html lang="zh" xmlns="http://www.w3.org/1999/html">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>库存管理-备件机出库表</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/jstree/jstree.min.css" rel="stylesheet">
    <link href="../plugin/bootstrap-fileinput-master/fileinput.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="../plugin/fileupload/css/jquery.fileupload.css">
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>


    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../js/base.js'></script>
    <script src="../plugin/soulUtils/soul_utils.js"></script>
    <script src='../plugin/jquery-3.2.1/jquery.form.js'></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/jstree/jstree.min.js"></script>
    <script src="../plugin/bootstrap-fileinput-master/fileinput.min.js"></script>
</head>

<body>

<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;
        var module = 'standbyMachineOutbound';
        var query = [{
            id: 'standbyBrandName',
            type: 'text',
            name: '品牌',
            paramName: 'standbyBrandName',
            palceholder: ''
        }, {
            id: 'standbyModel',
            type: 'text',
            name: '规格型号',
            paramName: 'standbyModel',
            palceholder: ''
        }, {
            id: 'standbyMachineName',
            type: 'text',
            name: '备用机名称',
            paramName: 'standbyMachineName',
            palceholder: ''
        }, {
            id: 'standbySerial',
            type: 'text',
            name: '备用机序列号',
            paramName: 'standbySerial',
            palceholder: ''
        }, {
            id: 'begin_creatDate',
            type: 'text',
            name: '申请开始时间',
            paramName: 'begin_creatDate',
            palceholder: ''
        }, {
            id: 'end_creatDate',
            type: 'text',
            name: '申请结束时间',
            paramName: 'end_creatDate',
            palceholder: ''
        }];
        var toolbar = {
            default: [true, false, false, false],// back;add;edit;remove
            dialog: [60, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: [{
                name: '归还备用机',
                glyphicon: 'arrow-left',
                onclick: 'sendBack',
            }]
        };
        // 表单内容配置
        var formElement = [];

        var bootstrapTable = {
            url: '',
            columns: [{
                radio: true
            },{
                field: 'homeLocation',
                title: '医院',
            },{
                field: 'department',
                title: '科室',
            },{
                field: 'standbyMachineName',
                title: '备用机名称',
            },{
                field: 'standbyBrandName',
                title: '品牌',
            },{
                field: 'standbyModel',
                title: '规格型号',
            },{
                field: 'standbySerial',
                title: '备用机序列号',
            },{
                field: 'applyPeople',
                title: '申请人姓名',
            },{
                field: 'applyTel',
                title: '申请人联系方式',
            },{
                field: 'applyReason',
                title: '申请理由',
            },{
                field: 'creatDate',
                title: '申请时间',
                formatter: BootstrapTableUtil.formatter.datetime
            }]
        };

        standbyMachineOutbound = SingleTablePageCreateUtil.createInstance(module, query, toolbar, null, bootstrapTable);

        standbyMachineOutbound.inventory = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#standbyMachineOutbound_table');
            if (!row) return false;
            if (1!= row.outboundStatus) {
                SwalUtil.error("该备用机不是待出库状态");
                return false;
            }
            var resp = AjaxUtil.postJson('standbyMachineOutbound/outbound', {
                standbyMachineApplyId: row.standbyMachineApplyId
            });
            if (resp) {
                SwalUtil.success(resp.msg);
                $('#standbyMachineOutbound_table').bootstrapTable('refresh');
            }
        };

        standbyMachineOutbound.sendBack = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#standbyMachineOutbound_table');
            if (!row) return false;
            var resp = AjaxUtil.postJson('standbyMachineOutbound/sendBack', {
                standbyMachineApplyId: row.standbyMachineApplyId
            });
            if (resp) {
                SwalUtil.success(resp.msg);
                $('#standbyMachineOutbound_table').bootstrapTable('refresh');
            }
        };
        // 初始化开始时间和结束时间
        $('#begin_creatDate').val(DateUtil.thirtyDayBeforeDate());
        $('#end_creatDate').val(DateUtil.nowDate());
        $('#begin_creatDate').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true,
        });
        $('#end_creatDate').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true,
        });

    });
    var DateUtil = {
        nowDate: function () {
            return FormatUtil.formatDate(new Date().getTime());
        },
        thirtyDayBeforeDate: function () {
            var now = new Date().getTime();
            now -= 1000 * 60 * 60 * 24 * 30;
            return FormatUtil.formatDate(now);
        }
    };

</script>


</body>

</html>